/**
 * 
 * @param {*} dom 
 * @returns {object} 
 */
function offset(dom){
    var left = 0;
    var top = 0
    while(dom != document.body){
        left += dom.offsetLeft + dom.clientLeft;
        top += dom.offsetTop + dom.clientTop;
        dom = dom.offsetParent
    }
    return {
        left:left,
        top:top
    }
}